package com.topone.controller;


import com.topone.sms.SmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/buyer")
@Slf4j
public class SmsController {

    @Autowired
    private SmsService smsSohuService;

    @GetMapping("/sendSms")
    public String sms(@RequestParam("phone") String phone){

        boolean backdoor = phone.startsWith("99");
        String code = smsSohuService.sendSmsCode(phone, backdoor);
        log.info("验证码＝{}",code);
        return code;
    }
}
